//
//  LEENavController.swift
//  SinaWeibo
//
//  Created by 李江波 on 2016/11/12.
//  Copyright © 2016年 lijiangbo. All rights reserved.
//

import UIKit

class LEENavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }

    //重写跳转方法
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        let count = childViewControllers.count
        
        if count > 0  {
            
            if let vc = viewController as? LEEBasicTableController {
                
                vc.navItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", taget: self, action: #selector(back))
            }else{
                
                self.navigationBar.isHidden = false
                viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", taget: self, action: #selector(back))
                
            }
            
            viewController.hidesBottomBarWhenPushed = true
            
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    
    @objc private func back() {
       
       self.navigationBar.isHidden = true
        
       popViewController(animated: true)
    }

   

}
